<template>
  <div class="container">
    <van-card
      v-for="item in gong"
      :key="item.id"
      :desc="item.desc"
      :title="item.name"
      :thumb="item.coverImage | dalImg"
      :thumb-link="'/#/detail?id=' + item.id"
    >
      <template #bottom>
        <van-tag plain type="danger">{{
          $moment(item.createdAt).format("YYYY-MM-DD")
        }}</van-tag>
      </template>
      <template #footer>
        <van-tag plain type="danger">浏览量{{ amount }}</van-tag>
      </template>
    </van-card>
  </div>
</template>

<script>
import { loadGong } from "../services/gonggao";
export default {
  data() {
    return {
      gong: [],
      amount: 0,
    };
  },
  async created() {
    const gong = await loadGong();
    console.log(gong.data);
    this.gong = gong.data;
    this.amount = Math.floor(Math.random() * 100);
  },
};
</script>
<style scoped>
.home {
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
}
header {
  width: 100%;
  height: 7rem;
  background: #4da630;
  text-align: center;
  overflow: hidden;
  position: relative;
}
h4 {
  color: white;
  margin-top: 1.8rem;
}
.weizhi {
  position: absolute;
  top: 4.1rem;
  left: 0.8rem;
}

::v-deep .van-search {
  padding: 0;
  width: 55%;
  float: right;
  margin-top: 1rem;
  margin-right: 5px;
  background-color: none;
}

.van-search .van-cell {
  padding: 0;
}
::v-deep .van-dropdown-menu {
  width: 30%;
  float: left;
  margin-top: 1rem;
  overflow: hidden;
  margin-left: 5px;
  border-radius: 10px;
}
::v-deep .van-dropdown-menu__bar {
  height: 24px;
  background: rgba(110, 110, 110, 0.5);
}
::v-deep .van-dropdown-menu__title {
  color: white;
}
::v-deep .van-swipe {
  margin-top: 1rem;
  height: 8rem;
}
.con {
  height: 100%;
  flex: 1;
  overflow-y: auto;
}
</style>
